package vip.liux.backend.infrastructure.textTemplate;


import java.util.HashMap;
import java.util.Map;

public class TemplateDefinition {

    public static final int MaxNameLength = 128;

    private String name;

    private String displayName;

    private boolean isLayout;

    private String layout;

    private String localizationResourceName;

    private boolean isInlineLocalized;

    private String defaultCultureName;

    private String renderEngine;

    private Map<String, Object> properties;

    public TemplateDefinition(String name, String localizationResourceName, String displayName, boolean isLayout, String layout, String defaultCultureName) {
        this.name = name;
        this.localizationResourceName = localizationResourceName;
        this.displayName = displayName;
        this.isLayout = isLayout;
        this.layout = layout;
        this.defaultCultureName = defaultCultureName;
        this.properties = new HashMap<>();
    }

    public TemplateDefinition(String name, String localizationResourceName, String displayName, boolean isLayout, String layout) {
        this(name, localizationResourceName, displayName, isLayout, layout, null);
    }

    public TemplateDefinition(String name, String localizationResourceName, String displayName) {
        this(name, localizationResourceName, displayName, false, null, null);
    }

    public TemplateDefinition(String name, String localizationResourceName) {
        this(name, localizationResourceName, name, false, null, null);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public boolean isLayout() {
        return isLayout;
    }

    public void setLayout(boolean layout) {
        isLayout = layout;
    }

    public String getLayout() {
        return layout;
    }

    public void setLayout(String layout) {
        this.layout = layout;
    }

    public String getLocalizationResourceName() {
        return localizationResourceName;
    }

    public void setLocalizationResourceName(String localizationResourceName) {
        this.localizationResourceName = localizationResourceName;
    }

    public boolean isInlineLocalized() {
        return isInlineLocalized;
    }

    public void setInlineLocalized(boolean inlineLocalized) {
        isInlineLocalized = inlineLocalized;
    }

    public String getDefaultCultureName() {
        return defaultCultureName;
    }

    public void setDefaultCultureName(String defaultCultureName) {
        this.defaultCultureName = defaultCultureName;
    }

    public String getRenderEngine() {
        return renderEngine;
    }

    public void setRenderEngine(String renderEngine) {
        this.renderEngine = renderEngine;
    }

    public Map<String, Object> getProperties() {
        return properties;
    }

    public void setProperties(Map<String, Object> properties) {
        this.properties = properties;
    }

    public Object getProperty(String name) {
        return properties.get(name);
    }

    public void setProperty(String name, Object value) {
        properties.put(name, value);
    }

    public TemplateDefinition withProperty(String key, Object value) {
        properties.put(key, value);
        return this;
    }

    public TemplateDefinition withRenderEngine(String renderEngine) {
        this.renderEngine = renderEngine;
        return this;
    }
}